// 联合类型  |
let pp : string | number | boolean= 50
pp = "sd"
pp = true

let arr5:(string|number)[] = [25,345,543,"zsd"]

//字面量类型
let ppp:3 = 3
let names:"zs" = "zs"

type User = {
    name:string,
    age:number,
    height:number
}

type ooo =string|number|boolean
type oooo = string
let vv:ooo = true
let vvv:oooo = "2M"         


let use:User = {
    name:"Voldy",
    age:18,
    height:188
}
console.log(`${use.name} ,${use.age} ,$`)

// interface可以继承
interface UserDemo extends User{
    id:number
}

let lll:UserDemo = {
    name:"xo",
    age:19,
    height:190,
    id:2
}

// 交叉  &
type ppp1 = User & {id:number}
let lll1:ppp1 = {
    name:"23",
    age:12,
    height:133,
    id:1
}
console.log(`${lll1.age} ; ${lll1.height}`)

// 断言 as
let el:unknown = 56;


console.log((el as number).toFixed(2))


let kkk:string|number = 'xiaohong'
console.log(kkk.length)

function get1():string|number{
    return"25"
}
let res6 = get1();
(res6 as string).length